;var module = angular.module('CtrlsContent');
module.controller('DiantibuyCtrl',['$scope','$state','api_other','yamiinfo_service','yamiinfo_service','weixinbuy_service',function($scope,$state,api_other,yamiinfo_service,yamiinfo_service,weixinbuy_service){
	$scope.infoModel = yamiinfo_service.Model;
	console.log($scope.infoModel);
	$scope.event = {
		submit:function(){
			var array = [];
			for (var i = yamiinfo_service.Model.yamiArray.length - 1; i >= 0; i--) {
				array.push(yamiinfo_service.Model.yamiArray[i].id);
			};
			var obj = {
				keyId:array,
				userId:parseInt(localStorage.bls_userId),
				name:yamiinfo_service.Model.name+"",
				phone:parseInt(yamiinfo_service.Model.phone),
				cardNo:parseInt(yamiinfo_service.Model.cardId),
				catId:localStorage.catId
			};
			var promise = api_other.yamidingdan(obj);
			promise.success(function(data){
				if(data.returnCode == 0){
					var orderId = data.returnData.orderId;
					weixinbuy_service.submit(orderId,2);
				}
			})
		}
	};
	//$scope.event.banner();
}])